#include "Triangle.h"
#include <QDebug>
#include <QString>

Triangle::Triangle()
{
    m_texture = 0;
}

Triangle::Triangle(QPoint* p1, QPoint* p2, QPoint* p3)
{
    m_texture = 0;
    m_vertexs.clear();
    m_vertexs.append(p1);
    m_vertexs.append(p2);
    m_vertexs.append(p3);
}

void Triangle::draw(QPainter* painter)
{

    if(filled())
    {
        FilledTriangle* filledTriangle = new FilledTriangle(m_vertexs,m_colors);
        if(m_texture != 0)
        {
            filledTriangle->setTexture(texture());
        }
        filledTriangle->draw(painter);
    }
    if(wired())
    {
        WiredTriangle* wiredTriangle = new WiredTriangle(m_vertexs,m_colors);
        wiredTriangle->draw(painter);
    }
}
